package model;

public class Student implements Comparable<Student> {
   private String name;
   private Integer age;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Integer getAge() {
        return age;
    }

    public void setAge(Integer age) {
        this.age = age;
    }



    @Override
    public int compareTo(Student o) {
        int num=this.age-o.getAge();//年龄的比较
        if (num==0)
            num=this.name.compareTo(o.getName());//年龄比较不了就比较名字
        return num;
    }
}
